<?php

class Sistema_IndexController extends App_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        $auth = Zend_Auth::getInstance();
        $s_user = $auth->getStorage();
        
        $this->view->sessao = new Zend_Session_Namespace('Modulos');
        
        //if($s_user->read()->USU_CADSTA == 0)
        //    return $this->_helper->redirector('concluircadastro', 'minhaconta',$this->modulo, array());
        
        $arr_mod = array();
        $where = 'MOD_ID > 0 ';
        
        $dscfiltro = $this->_getParam('dscfiltro', '');
        if($dscfiltro > '') $where .= ' and MOD_NOM like "%'. $dscfiltro.'%" ';
        $this->view->dscfiltro = $dscfiltro;
        
        if(strlen($dscfiltro) > 0){
            $query = 'SELECT SQL_CACHE MOD_ID FROM MODULOS WHERE '.$where.' ';
            $result = $this->db->fetchAll($query);
            foreach($result as $row) $arr_mod[$row['MOD_ID']] = $row['MOD_ID'];
        }
        
        $this->view->arr_mod = $arr_mod;
        
    }


}

